<template>
	<view class="main">
		<web-view :src="src" :webview-styles="{progress:true}" @message="handleMessage"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				token: '',
				src: '',
				userInfo: '',
				storageKeyEnum: this.$storageKeyEnum,
			}
		},
		onLoad(options) {
			this.token = uni.getStorageSync(this.storageKeyEnum.token_cache).data;
			this.userInfo = uni.getStorageSync(this.storageKeyEnum.userInfo).data;
			if (this.token) {
				this.src = this.src
				.concat(this.$configPath.baseURL).concat("/api/biz/getWechatInfoByMessage?userId="+this.userInfo.id)
				
				if (options.appletOrOfficialAccountId){
					this.src = this.src.concat("&appletOrOfficialAccountId=");
					this.src = this.src.concat(options.appletOrOfficialAccountId);
				}
			}
		},
		methods: {
			handleMessage(evt) {
				console.log('接收到的消息：' + JSON.stringify(evt.detail.data));
			}
		}
	}
</script>

<style lang="less">
	.main {
		height: 1450rpx;
		background-color: white;

		.u-slot-title {
			display: flex;
			align-items: center;
		}

		.u-cell-text {
			margin-right: 10rpx;
		}

		.text-info {
			font-size: 24rpx;
			color: rgba(0, 0, 0, 0.5);
		}
	}

	/deep/.u-cell {
		background-color: white;
	}

	/deep/.u-cell__body {
		padding: 40rpx 30rpx !important;
	}

	/deep/ .u-cell-text {
		font-size: 30rpx !important;
	}

	/deep/.u-button {
		width: 50px !important;
		height: 23px !important;
		border-radius: 12rpx !important;
		font-size: 20rpx !important;
	}
</style>
